package com.heima.article.feign;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.heima.apis.article.IArticleClient;
import com.heima.article.service.ArticleService;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * feign实现的远程调用的接口不写在当前服务的controller中
 * 而是单独写出来一个类，然后去继承我们在feign模块中定义的接口
 * @author 10161
 */
@RestController
public class ArticleClient implements IArticleClient {

    @Autowired
    private ArticleService articleService;
    /**
     * 暴露给其他微服务进行服务调用的保存文本接口
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/article/save")
    @Override
    public ResponseResult saveArticle(@RequestBody ArticleDto dto) {
        return articleService.saveArticle(dto);
    }
}
